package cn.shyouchi.wuguanjia.android.ui.event.report;

import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import cn.shyouchi.wuguanjia.android.R;

/**
 * Created by Eenie on 2016/11/18 at 14:01
 * Email: 472279981@qq.com
 * Des:
 */

public class ReportAdapter extends BaseQuickAdapter<ReportEntity.ResultMessageBean, BaseViewHolder> {

    ReportContract.View mView;

    public ReportAdapter(List<ReportEntity.ResultMessageBean> data, ReportContract.View view) {
        super(R.layout.item_event_report_layout, data);
        this.mView = view;
    }

    @Override
    protected void convert(BaseViewHolder holder, final ReportEntity.ResultMessageBean bean) {

        String s = "";


        if (bean.getService() != null && bean.getService().getId() != 0) {

            s = bean.getService().getServicesname();
        }

        holder.setText(R.id.tv_report_name, bean.getPostsetting().getPost() + "  " + s);
        holder.getView(R.id.item_layout).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mView.onItemClick(bean);
            }
        });
        holder.getView(R.id.btn_del).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mView.onDelClick(bean);
            }
        });
    }
}
